#include "file.h"

#include <QByteArray>
#include <QDateTime>

namespace Tubox {

File::File(const QString& name, const QString& path,
					 unsigned int size, unsigned int version,  const QString& modDate) :
name(name), path(path),
modDate(QDateTime::fromString(modDate,Qt::ISODate)), size(size), version(version), data(0) { }

File::File(QString& pathName, unsigned int size, unsigned int version) : size(size), version(version) , data(0) {
	int lastBarPos = pathName.lastIndexOf("/");
	name = pathName.right(pathName.size() - lastBarPos - 1);
	pathName.resize(lastBarPos + 1);
	path = pathName;
}

File::~File() { }

void File::setData(const QByteArray& _data) {
	data = _data;
}

QByteArray& File::getData() {
	return data;
}

}
